import { S } from '../../s';
import { IPSAppDEField } from './ipsapp-defield';
import { IPSAppDEMethodDTO } from './ipsapp-demethod-dto';
import { IPSAppDEMethodInput } from './ipsapp-demethod-input';
import { IPSAppDataEntity } from './ipsapp-data-entity';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppDEMethodInputImpl
  extends PSModelObjectImpl
  implements IPSAppDEMethodInput
{
  get codeName(): string {
    return this.M.codeName;
  }

  protected keypsappdefield: IPSAppDEField;
  getKeyPSAppDEField(): IPSAppDEField | null {
    if (this.keypsappdefield != null) return this.keypsappdefield;
    const value = this.M.getKeyPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.keypsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.keypsappdefield;
  }

  protected psappdemethoddto: IPSAppDEMethodDTO;
  getPSAppDEMethodDTO(): IPSAppDEMethodDTO | null {
    if (this.psappdemethoddto != null) return this.psappdemethoddto;
    const value = this.M.getPSAppDEMethodDTO;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdemethoddto = ipsappdataentity.findPSAppDEMethodDTO(value);
    }
    return this.psappdemethoddto;
  }

  get type():
    | 'NONE'
    | 'KEYFIELD'
    | 'KEYFIELDS'
    | 'DTO'
    | 'DTOS'
    | 'FILTER'
    | 'UNKNOWN'
    | 'USER'
    | 'USER2' {
    return this.M.type;
  }

  get output(): boolean {
    return this.M.output != null ? this.M.output : false;
  }
  get cls(): string {
    return 'PSAppDEMethodInputImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._3d0) return true;
    return super.instanceof(cls);
  }
}
